package com.swt.testdemo.config;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

/**
 * 接口返回通用Bean
 *
 * @author BleethNie
 * @version 1.0
 * @date 2020-01-10 18:12
 **/
@Setter
@Getter
@Builder
public class ResponseMessage {

    /**
     *  返回状态码
     */
    private Integer status;

    /**
     *  返回信息
     */
    private String message;

    public ResponseMessage(int status, String message) {
        this.status = status;
        this.message = message;
    }
    public static ResponseMessage getResponseMessage(Boolean isSuccess,String message){
        if(isSuccess){
            return ResponseMessage.builder()
                    .status(200)
                    .message(message+"成功")
                    .build();
        }else{
            return ResponseMessage.builder()
                    .status(500)
                    .message(message+"失败")
                    .build();
        }
    }
}